<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <style>
        .active {
            color: red;
        }
        
        li {
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div id="app">
        <div>dfasdfadsf</div>
        <div>dfasdfadsf</div>
        <div>dfasdfadsf</div>
    </div>
    <ul>
    </ul>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        // 获取app里面的html字符串
        var str = $('#app').html();
        console.log('str1', str);

        var str2 = $('#app').text();
        console.log('str2', str2);

        var str3 = `<li>第1个li元素</li>
        <li>第2个li元素</li>
        <li>第3个li元素</li>
        <li>第4个li元素</li>`;

        // 将str3字符串添加ul里面
        $('ul').html(str3);
    </script>
</body>

</html>